#!/usr/bin/env bash
set -e
set -u
set -o pipefail


test_get_absolute_path() {
    local current_dir=${1:?}
    local relative_dir=${2:?}
    source ${BASH_SOURCE%/*}/src/build.sh
    local result=$(get_absolute_path $current_dir $relative_dir)
    echo ${result}
}


assert_equals() {
    local name=${1:?}
    local expectation=${2:?}
    local result=${3:?}
    [[ "$expectation" == "$result" ]] || echo "$name: $expectation != $result"
}


test_main() {
    assert_equals "test_get_absolute_path" "/glux" $(test_get_absolute_path "/" "glux")
    assert_equals "test_get_absolute_path" "/foo/bar/." $(test_get_absolute_path "/foo/bar" ".")
    assert_equals "test_get_absolute_path" "/foo/bar/glux" $(test_get_absolute_path "/foo/bar" "glux")
}


test_main
